#!/bin/bash
#
# IBM Storwize V7000 performance monitoring shell script for Zabbix
#
# Sends perf data from svc_perf_wbem.py to Zabbix with zabbix_sender
# Handles all caching and logging, called from /etc/cron.d/svc_perf_cron every 5 min.
#
# 2013 Matvey Marinin
# 
# Usage:
#   svc_perf <cluster>
#
# Arguments:
#   cluster = Dns name or IP of Storwize V7000 block node (not Storwize V7000 Unified mgmt node!)
#
# 
set -e

. /etc/zabbix/externalscripts/svc_perf.conf

CLUSTER=$1

CACHE_FILE=/var/cache/zabbix/svc_perf.$CLUSTER.cache
ERR_LOG=/var/cache/zabbix/svc_perf.$CLUSTER.errlog

echo >>"$ERR_LOG"
date >>"$ERR_LOG"
/usr/bin/python /etc/zabbix/externalscripts/svc_perf_wbem.py --cluster $CLUSTER --user "$SVC_USER" --password "$SVC_PWD" --cachefile "$CACHE_FILE" 2>>"$ERR_LOG" | zabbix_sender -z 127.0.0.1 -I 127.0.0.1 -T -i - >>"$ERR_LOG" 2>&1
date >>"$ERR_LOG"

